<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html>
<head>

<title>Insert title here</title>
<style type="text/css">
input {
	width: 100%;
	height: 100%;
	border: 0px
}

</style>
</head>
<body>
	<table border="" cellspacing="0" cellpadding=""
		style="text-align: center;">



		<tr>
			<td>ID</td>
			<td>资产编码</td>
			<td>资产名</td>
			<td>资产凭证号</td>
			
			<td>产品序列号</td>
			<td>规格型号</td>
			<td>保修年限</td>
			<td>使用年限</td>
			
			<td>资产入账日期</td>
			<td>财务编码</td>
			<td>资产单价</td>
			<td>资产数量</td>
			<td>资产总价</td>
			
			<td>是否入库</td>
			<td>是否删除</td>
		</tr>
		<c:set var="a" value="0"></c:set>
		
		<c:forEach var="p" items="${list}">

			<form action="BuyServlet?act=buy_ruku" method="post">
				<tr>
					<td>${a+1}</td>


					<td><input type="text" id=id${a+1} style="text-align: center;"
						readonly="readonly" value=${p.zichannumber}></td>

					<td><input type="text" style="text-align: center;"
						readonly="readonly" value=${p.name } id=zichan${a+1}></td>
					<td><input type="text" id=pingzheng${a+1}
						style="text-align: center;"></td>
						<td><input type="text" id=xuliehao${a+1}  
						style="text-align: center;"></td>
						<td><input type="text" id=guige${a+1}
						style="text-align: center;"></td>
						<td><input type="text" id=baoxiu${a+1}
						style="text-align: center;"></td>
						<td><input type="text" id=shiyongnianxian${a+1}
						style="text-align: center;"></td>
						

					<td><input type="text" id=data${a+1}
						style="text-align: center;" value=""></td>

					<td><input type="text" id=bianma${a+1}
						style="text-align: center;"></td>

					<td><input type="text" style="text-align: center;"
						readonly="readonly" value=${p.danjia } id=danjia${a+1}></td>
					<td><input type="text" style="text-align: center;"
						readonly="readonly" value=${p.shuliang } id=shuliang${a+1}></td>
					<td><input type="text" style="text-align: center;"
						readonly="readonly" value=${p.zongjia } id=zongjia${a+1}></td>
					<td><input type="checkbox" id=text${a+1}
						style="width: 15px; height: 15px; border: 1px" /></td>
						<td><input type="button" id=dele${a+1}
						 border:1px" value="删除"  onclick="dele()" /></td>








				</tr>
				<c:set var="a" value="${a+1}"></c:set>
		</c:forEach>
		<td><input type="submit" id="text" name="" class="eldest1"
			value="提交" onclick="erea1()" /></td>

		</form>
	</table>





</body>
<script type="text/javascript">
	/* id zichan pingzheng data bianma danjia shuliang zongjia */

	var day2 = new Date();
	day2.setTime(day2.getTime());
	var s2 = day2.getFullYear() + "年" + (day2.getMonth() + 1) + "月"
			+ day2.getDate() + "日";
	var b = 2;

	for (var i = 1; i < b; i++) {
		b++;
		var zhi = document.getElementById("data" + i);
		if (zhi != null) {
			zhi.value = s2
		} else {
			break;
		}

	}

	function dele(id){
		alert(id);
		
		
	}
	function erea1() {

		var a = 2;
		var c = 0;

		for (var i = 1; i <= a; i++) {
			a++;
			var eldest = document.getElementById("text" + i);
			
			if (eldest != null) {
				if (eldest.checked == true) {
					
					c++;
					
					var en =document.getElementById("id" + i).name = "id" + c;
					
					document.getElementById("zichan" + i).name = "zichan" + c;

					document.getElementById("pingzheng" + i).name = "pingzheng"
							+ c;
					
					document.getElementById("xuliehao" + i).name = "xuliehao"
						+ c;
					document.getElementById("guige" + i).name = "guige"
						+ c;
					document.getElementById("baoxiu" + i).name = "baoxiu"
						+ c;
					document.getElementById("shiyongnianxian" + i).name = "shiyongnianxian"
						+ c;

					document.getElementById("data" + i).name = "data" + c;
					document.getElementById("bianma" + i).name = "bianma" + c;
					document.getElementById("danjia" + i).name = "danjia" + c;
					document.getElementById("shuliang" + i).name = "shuliang"
							+ c;

					document.getElementById("zongjia" + i).name = "zongjia" + c;

				} else {
					
					

				}
			}else {
				break;

			} 
		}

	}
</script>
</html>